package com.yoomiito.app.adapter.home.reommend;

import android.content.Context;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.alibaba.android.vlayout.DelegateAdapter;
import com.alibaba.android.vlayout.LayoutHelper;
import com.yoomiito.app.R;
import com.yoomiito.app.model.bean.BannerAndIconInfo;

import java.util.List;

/**
 * 首页--- 1拖N布局
 *
 */
public class HomeOneToNAdapter extends DelegateAdapter.Adapter<RecyclerView.ViewHolder> {

    private Context mContext;
    private LayoutHelper mLayoutHelper;
    private List<BannerAndIconInfo> mInfos;

    public HomeOneToNAdapter(Context context, LayoutHelper layoutHelper, List<BannerAndIconInfo> infos) {
        mContext = context;
        mLayoutHelper = layoutHelper;
        mInfos = infos;
    }

    @Override
    public LayoutHelper onCreateLayoutHelper() {
        return mLayoutHelper;
    }

    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.home_item_limited_time,parent,false);
        return new ItemViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
//        ItemViewHolder itemViewHolder = (ItemViewHolder) holder;
//        Glide.with(mContext).load(mInfos.get(position).getVip_img()).into(itemViewHolder.iv);
    }

    @Override
    public int getItemCount() {
        return mInfos.size();
    }

    private class ItemViewHolder extends RecyclerView.ViewHolder{

//        private ImageView iv;

        public ItemViewHolder(View itemView) {
            super(itemView);
//            iv = itemView.findViewById(R.id.home_item_iv);
        }
    }
}
